package cn.com.huzo.service.trade.impl;

import cn.com.huzo.model.entities.trade.SampleDevAttachedSheetPictureEntity;
import cn.com.huzo.repository.trade.SampleDevAttachedSheetPictureRepository;
import cn.com.huzo.service.trade.SampleDevAttachedSheetPictureManager;
import huzofw.common.util.file.DeleteDirectoryAndFile;
import huzofw.service.impl.GenericManagerImpl;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;

/**
 * 开发样品跟单表图片管理服务对象类实现。
 *
 * @author 吴旭
 */
@Service("SampleDevAttachedSheetPictureManager")
public class SampleDevAttachedSheetPictureManagerImpl extends GenericManagerImpl<SampleDevAttachedSheetPictureEntity, String>
        implements SampleDevAttachedSheetPictureManager {

    @Resource(name = "SampleDevAttachedSheetPictureRepository")
    private SampleDevAttachedSheetPictureRepository _SampleDevAttachedSheetPictureDao;

    /**
     * {@inheritDoc}
     *
     * @throws java.lang.Exception
     */
    @Override
    public List<SampleDevAttachedSheetPictureEntity> fetchAll(Long materialKey) throws Exception {
        return _SampleDevAttachedSheetPictureDao.fetchAll(materialKey);
    }

    /**
     * {@inheritDoc}
     *
     * @throws java.lang.Exception
     */
    @Override
    public String insert(SampleDevAttachedSheetPictureEntity instance) throws Exception {
        return _SampleDevAttachedSheetPictureDao.insert(instance);
    }

    /**
     * {@inheritDoc}
     *
     * @throws java.lang.Exception
     */
    @Override
    public Integer delete(SampleDevAttachedSheetPictureEntity instance) throws Exception {
        DeleteDirectoryAndFile.deleteFile(instance.getImageFileDir() + "/" + instance.getImageFileName());
        return _SampleDevAttachedSheetPictureDao.delete(instance.getLinesId());
    }
}
